<!--[if ie 6]>
      <style type="text/css">
      div#content div.buttonMinibox{width:200px;display:inline;float:none;overflow: hidden;}
      div#content div.buttonBox{width:600px;height:30px;}
      </style>
<![endif]-->

<?php
	echo $accessibility->whereIAm($pageTitle,array(array('title'=>'Voluntários','link'=>'/volunteers'),array('title'=>'Visualizar voluntário')));
	echo $this->renderElement('message');
	echo "<h2 id='contentTitle'>".$pageTitle."</h2>";
	echo "<div id='view'>";
	if (!empty($volunteer['User']['photo'])) {
		echo $html->image('../users/photo/'.$volunteer['User']['id'], array('class'=>'userPhoto'));
	}
	//echo "<p><label>ID :</label><span>".$volunteer['Volunteer']['id']."</span></p>";
	echo "<p><label>Nome: </label><span>".$volunteer['User']['name']."</span></p>";
	echo "<p><label>RG: </label><span>".$volunteer['Volunteer']['rg']."</span></p>";
	echo "<p><label>CPF: </label><span>".$volunteer['Volunteer']['cpf']."</span></p>";
	echo "<p><label>Endereço: </label><span>".$volunteer['User']['address']."</span></p>";

	if (isset($volunteer['User']['Cidade']['nome'])) {
		echo "<p><label>Cidade: </label><span>".$volunteer['User']['Cidade']['nome']."</span></p>";
	}else{
		echo "<p><label>Cidade: </label><span></span></p>";
	}
	if (isset($volunteer['User']['Cidade']['nome'])) {
		echo "<p><label>Estado: </label><span>".$volunteer['User']['Cidade']['Estado']['nome']."</span></p>";
	}else{
		echo "<p><label>Estado: </label><span></span></p>";
	}

	//echo "<p><label>Cidade: </label><span>".$volunteer['User']['Cidade']['nome']."</span></p>";
	echo "<p><label>Unidade:</label><span>";
	foreach ($volunteer['User']['Unit'] as $unit) {
		echo $unit['nome']."<br>";
	}

	echo "<p><label>Nascimento: </label><span>".date('d/m/Y',strtotime($volunteer['User']['birthdate']))."</span></p>";
	echo "<p><label>Profissão: </label><span>".$volunteer['Volunteer']['profissao']."</span></p>";

	//echo "<p><label>Cep:</label><span>".$volunteer['Volunteer']['cep']."</span></p>";
	echo "<p><label>Telefone: </label><span>".$volunteer['Volunteer']['telefone']."</span></p>";
	echo "<p><label>Celular: </label><span>".$volunteer['Volunteer']['celular']."</span></p>";
	echo "<p><label>Área de Atividade: </label><span>".$volunteer['Volunteer']['areaAtividade']."</span></p>";
	echo "<p><label>Estado Civil: </label><span>".$volunteer['Volunteer']['estCivil']."</span></p>";
	echo "<p><label>Responsável: </label><span>".$volunteer['Volunteer']['responsavel']."</span></p>";
	echo "<p><label>e-mail:</label><span>".$volunteer['Volunteer']['email']."</span></p>";
	echo "<p><label>Nome de Usuário:</label><span>".$volunteer['User']['username']."</span></p>";
	echo "<br";
	echo "<table id='horarios'>";
	echo "<tr>";
	echo "<td>Horário</td>";
	echo "<td>Domingo</td>";
	echo "<td>Segunda</td>";
	echo "<td>Terça</td>";
	echo "<td>Quarta</td>";
	echo "<td>Quinta</td>";
	echo "<td>Sexta</td>";
	echo "<td>Sábado</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td>Início</td>";
	echo "<td>".$volunteer['Horario']['domingo_inicio']."</td>";
	echo "<td>".$volunteer['Horario']['segunda_inicio']."</td>";
	echo "<td>".$volunteer['Horario']['terca_inicio']."</td>";
	echo "<td>".$volunteer['Horario']['quarta_inicio']."</td>";
	echo "<td>".$volunteer['Horario']['quinta_inicio']."</td>";
	echo "<td>".$volunteer['Horario']['sexta_inicio']."</td>";
	echo "<td>".$volunteer['Horario']['sabado_inicio']."</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td>Fim</td>";
	echo "<td>".$volunteer['Horario']['domingo_fim']."</td>";
	echo "<td>".$volunteer['Horario']['segunda_fim']."</td>";
	echo "<td>".$volunteer['Horario']['terca_fim']."</td>";
	echo "<td>".$volunteer['Horario']['quarta_fim']."</td>";
	echo "<td>".$volunteer['Horario']['quinta_fim']."</td>";
	echo "<td>".$volunteer['Horario']['sexta_fim']."</td>";
	echo "<td>".$volunteer['Horario']['sabado_fim']."</td>";
	echo "</tr>";
	echo "</table>";
	echo "<br />";

	/* Botoes - Inicio */
	$entity = 'volunteers';
	$model = 'Volunteer';
	$label = 'voluntário';
	$label_plural = 'voluntários';

	echo "<div class='buttonBox'>";
	echo "<div class='buttonMinibox'>";
	$listButton = "<span class=\"buttonList\">Listar ".$label_plural."</span>";
	echo html_entity_decode($html->link($listButton, '/'.$entity.'/',array('class'=>'button')));
	echo "</div>";
	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/edit/')) {
		$editButton = "<span class=\"buttonEdit\">Editar ".$label."</span>";
		echo html_entity_decode($html->link($editButton, '/'.$entity.'/edit/'.$volunteer[$model]['id'],array('class'=>'button')));
	}
	echo "</div>";
	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/delete/')) {
		$deleteButton = "<span class=\"buttonDelete\">Apagar ".$label."</span>";
		echo html_entity_decode($html->link($deleteButton,'/'.$entity.'/delete/'.$volunteer[$model]['id'], array('class'=>'button'), 'Confirma a exclusão deste item?'));
	}
	echo "</div>";
	echo "</div>";

	echo "<div class='buttonBox'>";
	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/send/')) {
		$sendButton = "<span class=\"buttonSendMail\">Enviar mensagem</span>";
		echo html_entity_decode($html->link($sendButton,'/messages/send/'.$volunteer['User']['id'], array('class'=>'button')));
	}
	echo "</div>";
	echo "</div>";
	/* Botoes - Fim */
	echo "</div>";
